#ifndef __IMU_BMI088_H__
#define __IMU_BMI088_H__

#include "xag_types.h"

/**
  ******************************************************************************
  * @file           : bmi088.h
  * @brief          : Header for bmi088-*.c file.
  *                   This file contains the common defines of the application.
  * @author			: ac
  * @attention
  *
  *		Copyright (c) 2021 Technology Co., Ltd.
  *
  *******************************************************************************
  */

#ifdef __cplusplus
 extern "C" {
#endif

/* spi device */
#define SPI00 "/dev/spidev0.0"



/* 
 * Gryoscope register address 
 */
#define BMI088_GYRO_RANGE_REG                      (0x0F)
#define BMI088_GYRO_BANDWIDTH_REG                  (0x10)
#define BMI088_GYRO_X_LSB_REG                      (0x02)

/* Gyro X LSB data register */
#define BMI088_GYRO_X_LSB_REG                      (0x02)
/* Gyro X MSB data register */
#define BMI088_GYRO_X_MSB_REG                      (0x03)
/* Gyro Y LSB data register */
#define BMI088_GYRO_Y_LSB_REG                      (0x04)
/* Gyro Y MSB data register */
#define BMI088_GYRO_Y_MSB_REG                      (0x05)
/* Gyro Z LSB data register */
#define BMI088_GYRO_Z_LSB_REG                      (0x06)
/* Gyro Z MSB data register */
#define BMI088_GYRO_Z_MSB_REG                      (0x07)



/* Gyro Range */
#define BMI088_GYRO_RANGE_2000_DPS                 (0x00)
#define BMI088_GYRO_RANGE_1000_DPS                 (0x01)
#define BMI088_GYRO_RANGE_500_DPS                  (0x02)
#define BMI088_GYRO_RANGE_250_DPS                  (0x03)
#define BMI088_GYRO_RANGE_125_DPS                  (0x04)

/* Gyro Output data rate and bandwidth */
#define BMI088_GYRO_BW_532_ODR_2000_HZ             (0x00)
#define BMI088_GYRO_BW_230_ODR_2000_HZ             (0x01)
#define BMI088_GYRO_BW_116_ODR_1000_HZ             (0x02)
#define BMI088_GYRO_BW_47_ODR_400_HZ               (0x03)
#define BMI088_GYRO_BW_23_ODR_200_HZ               (0x04)
#define BMI088_GYRO_BW_12_ODR_100_HZ               (0x05)
#define BMI088_GYRO_BW_64_ODR_200_HZ               (0x06)
#define BMI088_GYRO_BW_32_ODR_100_HZ               (0x07)
#define BMI088_GYRO_ODR_RESET_VAL                  (0x80)


/* 
 * Accelerometer register address 
 */





/*
 * Gryoscope dependent structure
 */

/* gryoscope sensor data */
struct imu_gryoscope_sensor_data 
{
	XAG_S16 x;
	XAG_S16 y;
	XAG_S16 z;
};

/* gryoscope result data */
struct imu_gyroscope
{
	XAG_F64 gyro_x_deg;
	XAG_F64 gyro_y_deg;
	XAG_F64 gyro_z_deg;
};


/*
 * Accelerometer dependent structure
 */

/* accelerometer sensor data */
struct imu_accelerometer_sensor_data 
{
	XAG_S16 x;
	XAG_S16 y;
	XAG_S16 z;
};

/* accelerometer sensor data */
struct imu_accelerometer
{
	XAG_F64 acce_x_deg;
	XAG_F64 acce_y_deg;
	XAG_F64 acce_z_deg;
};


/*
 * read gyroscope
 */
XAG_VOID xag_user_read_gyroscope();

/*
 * read accelerometer
 */
XAG_VOID xag_user_read_accelerometer();

/*
 * exception handling
 */
XAG_VOID __do_abnormal(const char * str);



#ifdef __cplusplus
}
#endif

#endif /* __IMU_BMI088_H__ */
